__list = {}

class Error(Exception): pass
class UserExists(Error): pass

class Abstract(object):

  def __init__(self, handler, type):
    self.handler = handler
    self.type = type

  def create(self, id=None, email=None, password=None, name=None):
    raise Error('manage user not setup')

  def delete(self, id=None, email=None):
    raise Error('manage user not setup')

  def login(self, session, id=None, email=None, password=None):
    raise Error('manage user not setup')

  def logout(self, session, id=None, email=None, user=None):
    raise Error('manage user not setup')

def get(handler, type):
  global __list
  (module, args, kwargs) = __list[type]
  return module(handler, type, *args, **kwargs)

def set(module, type, *args, **kwargs):
  global __list
  __list[type] = (module, args, kwargs)
